/**
 * 文件名    ： LoginImpl.java
 * 版权       : XX科技有限公司。
 * 描述       : <描述>
 * 修改时间：2018年11月14日
 * 修改内容：<修改内容>
 */
package com.example.demo.application.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.example.demo.application.common.base.BaseServiceImpl;
import com.example.demo.application.dao.IMsgDao;
import com.example.demo.application.model.LoginUserEntity;
import com.example.demo.application.model.MsgEntity;
import com.example.demo.application.model.NodeEntity;
import com.example.demo.application.model.RemindEntity;
import com.example.demo.application.service.IMsgService;

/**
 * <功能>
 * @author    87431
 * @version   [版本号，2019年2月16日]
 * @see       [相关类/方法]
 * @since     [产品/模块版本]
 */
@Service(value = "remideService")
public class RemideserviceImpl extends BaseServiceImpl<MsgEntity>  implements IMsgService {
	
    @Autowired  
    private IMsgDao msgDao;  
	  
	@Override
	public List<MsgEntity> findByParams(MsgEntity t) throws Exception {
		return msgDao.findByParams(t);
	}

	@Override
	public RemindEntity findRemindByUser(String userToken) throws Exception {
		LoginUserEntity user = getUserByToken(userToken);
		RemindEntity remind = msgDao.findByUserId(user.getId());
		return remind;
	}

	@Override
	public List<NodeEntity> findNodeByUser(String userToken) throws Exception {
		LoginUserEntity user = getUserByToken(userToken);
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<MsgEntity> findMsgByUser(String userToken) throws Exception {
		LoginUserEntity user = getUserByToken(userToken);
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	@Transactional(rollbackFor = Exception.class)
	public int addNodeByUser(NodeEntity obj) throws Exception {
		msgDao.addNode(obj);
		return 1;
	}

	@Override
	@Transactional(rollbackFor = Exception.class)
	public int addMsgByUser(MsgEntity obj) throws Exception {
		msgDao.addMsg(obj);
		return 1;
	}
	

}
